<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
<script>
    function a()
    {
        var x=prompt("请输入操作数1","");
        var y=prompt("请输入操作数2","");
        var z=prompt("请选择运算方式，1为+，2为-，3为*，4为/","");
        if(z==1)
        {
            s=parseInt(x)+parseInt(y);
            return x+"+"+y+"="+s
        }
        if(z==2)
        {
            s=parseInt(x)-parseInt(y);
            return x+"-"+y+"="+s;
        }
        if(z==3)
        {
            s=parseInt(x)*parseInt(y);
            return x+"*"+y+"="+s;
        }
        if(z==4)
        {
            s=parseInt(x)/parseInt(y);
            return x+"/"+y+"="+s;
        }
    }
    alert(a())
</script>
</body>
</html>